package com.zh.Controller;

import com.zh.Service.LoginService;
import com.zh.bean.Userinfo;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;
import javax.naming.Name;
import java.util.List;
@Component("testController")
public class TestController {
    @Resource(name = "loginSevice")
    LoginService loginService;
    @Resource(name = "UserInfoBean")
    Userinfo userInfoBean;
    // 依赖一个集合对象，也可以进行依赖注入
    List<Object> lstStrs;
    /**
     * 进行登录处理
     *
     * @return
     */
    public boolean doLogin() {
        boolean canLogined = false;

        // 调用service层
//        System.out.println("依赖注入的集合的内容：" + lstStrs.toString());
        // 进行登录业务逻辑
        canLogined = loginService.doLogin(userInfoBean);
        return canLogined;
    }

    public void setLoginService(LoginService loginService) {
        this.loginService=loginService;
    }

    public void setUserInfoBean(Userinfo userInfoBean) {
        this.userInfoBean=userInfoBean;
    }

    public void setLstStrs(List lstStrs) {
        this.lstStrs=lstStrs;
    }

}
